package com.moon.interface_api.service.serviceImpl;

import com.moon.interface_api.anno.TargetDataSource;
import com.moon.interface_api.domain.UserDO;
import com.moon.interface_api.enums.DataSourceKey;
import com.moon.interface_api.persistence.UserDao;
import com.moon.interface_api.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service
public class UserServiceImpl implements UserService {
	@Autowired
	private UserDao userDao;
	
	@Override
	public UserDO get(Integer id){
		return userDao.get(id);
	}

	@Override
	public UserDO getUserByPhoneNum(String phoneNum) {
		HashMap<String, Object> map = new HashMap<>();
		map.put("phoneNum",phoneNum);
		UserDO userDO = list(map).get(0);
		return userDO;
	}

	@Override
	public List<UserDO> list(Map<String, Object> map){
		return userDao.list(map);
	}
	
	@Override
	
	public int count(Map<String, Object> map){
		return userDao.count(map);
	}
	
	@Override
	public int save(UserDO user){
		return userDao.save(user);
	}
	
	@Override
	public int update(UserDO user){
		return userDao.update(user);
	}
	
	@Override
	public int remove(Map<String, Object> params){
		return userDao.remove(params);
	}
	
	@Override
	public int batchRemove(Integer[] ids){
		return userDao.batchRemove(ids);
	}

    @Override
    public int delete(Map<String, Object> params) {
        return userDao.delete(params);
    }

    @Override
    public int batchDelete(Integer[] ids) {
        return userDao.batchDelete(ids);
    }
	
}
